Hệ thống quản lý thanh toán POS nhà hàng

1 Imports System.Data.OleDb
2
3 Public Class frmDeleteInvoice
4
5     Sub Reset()
6         dtpDate.Value = Now
7         dtpDate.Focus()
8     End Sub
9  
10     Private Sub btnClose_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
11         Me.Close()
12     End Sub
13
14     Public Sub DeleteRecord()
15         Try
16             Dim RowsAffected As Integer =
0
17             con = New OleDbConnection(cs)
18             con.Open()
19             Dim ct1 As String =
"delete from KOTgeneration where BillDate < #" & dtpDate.Value & "#"
20             cmd = New OleDbCommand(ct1)
21             cmd.Connection = con
22             cmd.ExecuteNonQuery()
23             If con.State = ConnectionState.Open Then
24                 con.Close()
25             End If
26             con = New OleDbConnection(cs)
27             con.Open()
28             Dim ct As String =
"delete from RestaurantBillingInfo where BillDate < #" & dtpDate.Value & "#"
29             cmd = New OleDbCommand(ct)
30             cmd.Connection = con
31             RowsAffected = cmd.ExecuteNonQuery()
32             If con.State = ConnectionState.Open Then
33                 con.Close()
34             End If
35             If RowsAffected >
0 Then
36                 Dim st As String =
"deleted the all invoices till date '" & Now.ToString("dd/MM/yyyy hh:mm:ss tt") & "'"
37                 LogFunc(lblUser.Text, st)
38                 MessageBox.Show(
"Successfully deleted", "Record", MessageBoxButtons.OK, MessageBoxIcon.Information)
39                 Reset()
40                 Reset()
41             Else
42                 MessageBox.Show(
"No record found", "Sorry", MessageBoxButtons.OK, MessageBoxIcon.Information)
43                 Reset()
44             End If
45             con.Close()
46         Catch ex As Exception
47             MessageBox.Show(ex.Message,
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
48         End Try
49     End Sub
50
51     Private Sub btnDelete_Click(sender As System.Object, e As System.EventArgs) Handles btnDelete.Click
52         Try
53             If MessageBox.Show(
"Do you really want to delete?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) = Windows.Forms.DialogResult.Yes Then
54                 DeleteRecord()
55             End If
56         Catch ex As Exception
57             MessageBox.Show(ex.Message,
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
58         End Try
59     End Sub
60 End Class


Gõ tìm kiếm nhanh...